/*******************************************************************************
 * Copyright (c) SCUT. 2022. All rights reserved.
 * Description: Macro define to realize 4 data type.
 * Author: linhouzhong
 * Create: 2022-06-26
 *******************************************************************************/

#pragma once
#include <omp.h>

#define MAX(x, y) KmlMax(x, y)
#define MIN(x, y) KmlMin(x, y)

#ifdef SINGLE
typedef float dataAccu;
typedef float dataType;
#define ZERO 0
#define ONE 1
#define EIGHT 8
#define SEVTEN 17
#define T_ONE ONE
#define P_ONE ONE
#define P_NEG_ONE -ONE
#define P_R1 r1
#define ABS_ fabs
#define lamch_ Slamch
#define I_AMAX cblas_isamax
#define COPY_ cblas_scopy
#define GEMM_ cblas_sgemm
#define GEMV_ cblas_sgemv
#define SCAL_ cblas_sscal
#define SWAP_ cblas_sswap
#define SYR_ cblas_ssyr
#define TRSM_ cblas_strsm
#define SYTRF_RK ssytrf_rk
#define SYTRS_3 ssytrs_3
#define SYTF2_RK ssytf2_rk
#define LASYF_RK slasyf_rk
#define SYSV_RK ssysv_rk
#endif
#ifdef DOUBLE
typedef double dataAccu;
typedef double dataType;
#define ZERO 0
#define ONE 1
#define EIGHT 8
#define SEVTEN 17
#define T_ONE ONE
#define P_ONE ONE
#define P_NEG_ONE -ONE
#define P_R1 r1
#define ABS_ fabs
#define lamch_ Dlamch
#define I_AMAX cblas_idamax
#define COPY_ cblas_dcopy
#define GEMM_ cblas_dgemm
#define GEMV_ cblas_dgemv
#define SCAL_ cblas_dscal
#define SWAP_ cblas_dswap
#define SYR_ cblas_dsyr
#define TRSM_ cblas_dtrsm
#define SYTRF_RK dsytrf_rk
#define SYTRS_3 dsytrs_3
#define SYTF2_RK dsytf2_rk
#define LASYF_RK dlasyf_rk
#define SYSV_RK dsysv_rk
#endif
#ifdef COMPLEX
#include <complex.h>
typedef float dataAccu;
typedef float complex dataType;
#define ZERO 0
#define ONE 1
#define EIGHT 8
#define SEVTEN 17
#define T_ONE CONE
#define P_ONE &CONE
#define P_NEG_ONE &NEG_CONE
#define P_R1 &r1
#define ABS_ CABS
#define CABS(Z) (fabs(creal(Z)) + fabs(cimag(Z)))
#define lamch_ Slamch
#define I_AMAX cblas_icamax
#define COPY_ cblas_ccopy
#define GEMM_ cblas_cgemm
#define GEMV_ cblas_cgemv
#define SCAL_ cblas_cscal
#define SWAP_ cblas_cswap
#define SYR_ my_csyr
#define TRSM_ cblas_ctrsm
#define SYTRF_RK csytrf_rk
#define SYTRS_3 csytrs_3
#define SYTF2_RK csytf2_rk
#define LASYF_RK clasyf_rk
#define SYSV_RK csysv_rk
#endif
#ifdef COMPLEX16
#include <complex.h>
typedef double dataAccu;
typedef double complex dataType;
#define ZERO 0
#define ONE 1
#define EIGHT 8
#define SEVTEN 17
#define T_ONE CONE
#define P_ONE &CONE
#define P_NEG_ONE &NEG_CONE
#define P_R1 &r1
#define ABS_ CABS
#define CABS(Z) (fabs(creal(Z)) + fabs(cimag(Z)))
#define lamch_ Dlamch
#define I_AMAX cblas_izamax
#define COPY_ cblas_zcopy
#define GEMM_ cblas_zgemm
#define GEMV_ cblas_zgemv
#define SCAL_ cblas_zscal
#define SWAP_ cblas_zswap
#define SYR_ my_zsyr
#define TRSM_ cblas_ztrsm
#define SYTRF_RK zsytrf_rk
#define SYTRS_3 zsytrs_3
#define SYTF2_RK zsytf2_rk
#define LASYF_RK zlasyf_rk
#define SYSV_RK zsysv_rk
#endif